﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zj.OpenAuth.Domain.Core;
using Zj.OpenAuth.Repository.Models;

namespace Zj.OpenAuth.ConsoleView
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                InitData();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.ReadKey();
        }

        //private static async Task InitData()
        //{
        //    using (var db = new OpenAuthDbContext())
        //    {
        //        db.Set<Menu>().Add(new Menu() { Name = "系统设置", Url = "/Home/Index" });
        //        await db.SaveChangesAsync();
        //    }
        //}

        private static void InitData()
        {
            using (var db = new OpenAuthDbContext())
            {
                //db.Set<Menu>().Add(new Menu() { Name = "系统设置", Url = "/Home/Index" });
                //db.Set<Menu>().Add(new Menu() { Name = "用户信息", Url = "/User/Index" });
                //db.Set<Menu>().Add(new Menu() { Name = "部门信息", Url = "/Department/Index" });
                //db.Set<Menu>().Add(new Menu() { Name = "角色信息", Url = "/Role/Index" });
                //db.Set<Menu>().Add(new Menu() { Name = "菜单信息", Url = "/Menu/Index" });
                //db.Set<Menu>().Add(new Menu() { Name = "日志管理", Url = "/Log/Index" });
                db.SaveChanges();

                //var menus = db.Set<Menu>().SingleOrDefault(m=>m.Id==3).Children;
            }
        }
    }
}
